<?php
class tReport
	{
	public $report_code;
	public $report_data;
	public $db;
	//1.query from meta table for report customization id for this user. If not exists use default customization for the report code
	//2.view name is user id _ report code
	//3.create temp table with name tmp_user id_report code from the view
	//4.get constraint values from journal
	//5.get group by values from journal
	function generateReport()
		{
		$user_id=($_SESSION["guser_id"])?$_SESSION["guser_id"]:"1001";
		$this->db->query="SELECT generateReport('".$this->report_code."',".$user_id.")";
		$this->db->runQuery();
		$this->db->query="SELECT * FROM report_data";
		$this->db->runQuery();
		$this->report_data=$this->db->returnArrays();
		}
	}
?>
